﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="lp_PersonalDDetail.aspx.cs"
    Inherits="ZLDC.Estate.Quantify.lp_PersonalDDetail" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="css/page.css" rel="stylesheet" type="text/css" />

    <script src="flexigrid/jquery.js" type="text/javascript"></script>

    <link href="../css/main.css" rel="stylesheet" type="text/css" />
    <link href="css/page.css" rel="stylesheet" type="text/css" />

    <script src="js/lp_Basis.js" type="text/javascript"></script>

    <script src="../js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>

    <script src="js/GetUrl.js" type="text/javascript"></script>
    <script src="../js/LexunJS.js" type="text/javascript"></script>

    <script type="text/javascript">

        var opentype = LexunJS.GetQueryString("opentype"); // 楼盘ID

        function bindGrid() {
            $("#table1").flexigrid(
			{
			    sortname: "",
			    sortorder: "asc",
			    sortable: true,
			    usepager: false,
			    title: false,
			    rocmsg: '正在查询，请稍等...', //正在处理的提示信息
			    nomsg: '没有记录',
			    showTableToggleBtn: true,
			    width: "600",
			    height: "300"
			}
		    );
        }

        function fkqi(userid, typename) {
            var time = document.getElementById('txtTime').value;
            var param = "&salesmanid=" + userid + "&addDate1=" + time + "&addDate2=" + time;

            var atype = '<%=type %>';
            if (atype == '2') {
                AAlert(typename, param, opentype);
            }
            else {
                AAlert1(typename, param, opentype);
            }

        }

      
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        工作时间:<asp:TextBox ID="txtTime" runat="server" onClick="WdatePicker()"></asp:TextBox><asp:Button
            ID="btnTime" runat="server" Text="查询" OnClick="btnTime_Click" CssClass="button1" /><a
                id="atime" runat="server"></a><a id="a1" runat="server"></a>
        <asp:Panel ID="Panel1" runat="server" Width="95%">
            <table id="table1" width="550px" border='0' cellpadding='0' cellspacing='1' bgcolor='#a8c7ce'>
                <thead>
                    <tr>
                        <th align="center" width="60px" bgcolor='d3eaef' class='STYLE6'>
                            
                        </th>
                        <th align="center" width="25%" bgcolor='d3eaef' class='STYLE6'>
                            要求工作
                        </th>
                        <%--   <th align="center" width="90" bgcolor='d3eaef' class='STYLE6'>
                            实际完成数量
                        </th>--%><%-- <th align="center" width="60" bgcolor='d3eaef' class='STYLE6'>
                            要求得分
                        </th>--%>
                        <th align="center" width="60px" bgcolor='d3eaef' class='STYLE6'>
                            要求得分
                        </th>
                        <th align="center" width="60px" bgcolor='d3eaef' class='STYLE6'>
                            完成数量
                        </th>
                        <th align="center" width="60px" bgcolor='d3eaef' class='STYLE6'>
                            实际得分
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <asp:Repeater ID="Repeater1" runat="server">
                        <ItemTemplate>
                            <tr>

                                 <td><%# Getcount(Eval("Other1").ToString())%></td>
                                <td class='STYLE10'> <asp:HiddenField ID="hidid" runat="server" Value='<%# Eval("BasisCode") %>' />
                                    <a style="text-decoration:underline" onclick="fkqi(<%# Eval("userid")%>,'<%# Eval("BasisName")%>')">
                                        <%# Eval("BasisName")%></a><%# Eval("Quantity")%><%# GetUnit(Eval("Quantity"),Eval("BasisCode"))%>
                                </td>
                                <%--   <td class='STYLE10'>
                                    <asp:TextBox ID="txtActual_Goal" Width="50px" onkeydown="myKeyDown()" runat="server"></asp:TextBox>
                                </td>--%>
                                <td class='STYLE10'>
                                    <%--<asp:TextBox ID="TextBox2" Width="50px" onkeydown="myKeyDown()" runat="server"></asp:TextBox>--%>
                                    <%# Eval("SinglePoint")%>
                                    <asp:HiddenField ID="hidPoint" runat="server" Value='<%# Eval("Point") %>' />
                                    <asp:HiddenField ID="hidName" runat="server" Value='<%# Eval("BasisName") %>' />
                                    <asp:HiddenField ID="hidRemark" runat="server" Value='<%# Eval("remark") %>' />
                                    <asp:HiddenField ID="hidQuantity" runat="server" Value='<%# Eval("Quantity") %>' />
                                    <asp:HiddenField ID="hidmainID" runat="server" Value='<%# Eval("Mainid") %>' />
                                </td>
                              
                                   
                                     <%# GetRed(Eval("Quantity").ToString(), Eval("Actual_Number").ToString())%>
                                    <%# Eval("Actual_Goal")%>
                                    
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                 <tr>
                        <td>
                         
                        </td>
                        <td >
                        </td>
                        <td>
                          
                        </td>
                        <td>
                        </td>
                        <td>
                          
                        </td>
                    </tr>
                   <tr>
                        <td>
                            总分:
                        </td>
                        <td >
                        </td>
                        <td>
                            <a id="A2" runat="server"></a>
                        </td>
                        <td>
                        </td>
                        <td>
                            <a id="txtallnum1" runat="server"></a>
                        </td>
                    </tr>
                </tbody>
            </table>
            <table  width="550px" border='0' cellpadding='0' cellspacing='1' bgcolor='#a8c7ce'>
              
                    <tr>
                        <td >
                            <div id="divuserurl" runat="server">
                            </div>
                        </td>
                    </tr>
                    <tr><td>
                        <asp:Button ID="btnupdate" runat="server" Text="检查完成" CssClass="button1" 
                            onclick="btnupdate_Click" /></td></tr>
            </table>
            <%-- 
            最低总分:<input id="txtTotal1" value="0" runat="server" name="txtTotal1" readonly="readonly"
                type="text" /><input id="Button1" type="button" value="关 闭" onclick="parent.ClosePop()" />--%>
            <table style="text-align: center; margin-top: 20px;width:80%;" runat="server" id="tblist">
                <tr>
                    <td>
                        工作意见：
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:TextBox ID="txtRemark" TextMode="MultiLine" runat="server" Width="80%"></asp:TextBox>
                 <%--       <asp:Button
                            ID="Button1" runat="server" Text="发送" CssClass="button1" OnClick="Button1_Click" />--%>
                        <input id="Button2" type="button" value="发送" onclick="Reply(1)"  />
                    </td>
                </tr>
                <tr><td>
                <div id="ReplyList"></div>
                </td></tr>
            </table>
        </asp:Panel>
    </div>
    <script type="text/javascript">
    
    
    //发送意见
        function Reply(type) {
            var mainid = '<%=mainid %>';
            var userid = '<%=u_id %>';
            var txttime = document.getElementById('txtTime').value;
            var txtRemark = document.getElementById('txtRemark').value;
          
                $.ajax({
                    type: "POST",
                    url: "AjaxServer.aspx",
                    dataType: 'json',
                    data: "alt=ReplyList&type=" + type + "&userid=" + userid + "&mainid=" + mainid + "&txttime=" + escape(txttime) + "&txtremark=" + escape(txtRemark) + "",
                    processData: false,
                    timeout: '10000',
                    success: function(msg) {
                        divlist(msg);
                        document.getElementById('txtRemark').value = '';
                    },
                    error: function() {
                        document.getElementById('ReplyList').innerHTML = "";
                    }

                });
            
           
        }
        function divlist(msg) {
            var arr = [];
            arr.push("<table  border='0' cellpadding='0' cellspacing='1' bgcolor='#a8c7ce' class=\"table\" valign='top'>");
            arr.push("<tr bgcolor=\"#353c44\" >");
            arr.push("<td width=\"220px\"  style='text-align: center;background-color: #d3eaef'  >");
            arr.push("<div >意见</div>");
            arr.push("</td>");
            arr.push("<td width=\"125px\"  style='text-align: center;background-color: #d3eaef'>");
            arr.push("<div >发送人</div>");
            arr.push("</td>");
            arr.push("</tr>");
            for (var i = 0; i < msg.msg.length; i++) {

                if (i % 2 == 0)
                    arr.push("<tr bgcolor='#FFFFFF'>");
                else
                    arr.push("<tr bgcolor='#EEEDED'>");
                arr.push("<td height='20' class='STYLE6'  style='text-align: center;'>");
                arr.push(msg.msg[i].reply);
                arr.push("</td>");
                arr.push("<td height='20' class='STYLE6'  style='text-align: center;'>");
                arr.push(msg.msg[i].createname);
                arr.push("</td>");
                arr.push("</tr>");
            }

            arr.push("</table>");
            document.getElementById('ReplyList').innerHTML = arr.join('');
        }
        window.onload = function() {
            var tb = document.getElementById('table1');
            var tbtd = 0;
            var tbtr = 0;
            for (var i = 1; i < tb.rows.length - 2; i++) {
                if (tb.rows[i].cells[0].innerHTML == '未分配完成') {
                    tbtd++;
                }
                else {
                    tbtr++;
                }

            }

            if (tbtr > 0) {
                tb.rows[1].cells[0].rowSpan = tbtr;
                for (var i = 2; i <= tbtr; i++) {
                    tb.rows[i].cells[0].style.display = 'none';
                }
            }
            if (tbtd > 0) {

                tb.rows[tbtr + 1].cells[0].rowSpan = tbtd;

                for (var i = (parseInt(tbtr + 1)); i < tb.rows.length - 2; i++) {
                    tb.rows[i + 1].cells[0].style.display = 'none';
                }
            }
            Reply(0);
            var typeTB = '<%=type %>';
            if (typeTB == '2') {
                document.getElementById('tblist').style.display = 'none';
            }
        }
      
           
    </script>
    </form>
</body>
</html>
